<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_users', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->charset = 'utf8mb4';
            $table->bigIncrements('user_id')->comment('用户id');
            $table->string('name')->comment('用户名');
            $table->string('password', 500)->comment('用户密码');
            $table->text('last_token')->nullable()->comment('上次登录的token');
            $table->char('phone', 15)->unique()->comment('用户注册手机');
            $table->string('avatar')->nullable()->comment('头像');
            $table->string('wechat', 60)->nullable()->comment('微信号');
            $table->string('qq', 16)->nullable()->comment('qq号');
            $table->string('email', 50)->nullable()->comment('电子邮箱');
            $table->tinyInteger('status')->default(0)->comment('用户状态 -1代表已删除 1代表正常 0代表冻结');
            $table->timestamp('logined_at')->nullable()->comment('最近登入的时间');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE admin_users AUTO_INCREMENT=10000");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_users');
    }
}
